From 43e3082a43290155bad87d5dfc24405f2a7c3a0e Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 26 Dec 2006 11:02:15 +0000 Subject: [PATCH] Fix small regressions in GtkNotebook tab detaching. Bug #378852. 2006-12-26 Carlos Garnacho Fix small regressions in GtkNotebook tab detaching. Bug #378852. * gtk/gtknotebook.c (gtk_notebook_do_arrow): grab focus to allow tabs scrolling when hovering with a detached tab. (gtk_notebook_stop_reorder): Do not deparent the wrong tab if the focus tab has changed during a tab DND operation. (gtk_notebook_drag_end): ensure that the dropped tab gets focused. (gtk_notebook_paint): do not take cur_page as a reference to paint the box if it's detached. (gtk_notebook_calculate_tabs_allocation): focus_tab may be different to the detached tab if we hover the arrows during a tabs detaching operation, do not allocate it unconditionally in 0,0. --- ChangeLog | 15 +++++++++++++++ gtk/gtknotebook.c | 32 +++++++++++++++++++------------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 14ca051c80..8006d79e90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2006-12-26 Carlos Garnacho + + Fix small regressions in GtkNotebook tab detaching. Bug #378852. + + * gtk/gtknotebook.c (gtk_notebook_do_arrow): grab focus to allow tabs + scrolling when hovering with a detached tab. + (gtk_notebook_stop_reorder): Do not deparent the wrong tab if the + focus tab has changed during a tab DND operation. + (gtk_notebook_drag_end): ensure that the dropped tab gets focused. + (gtk_notebook_paint): do not take cur_page as a reference to paint the + box if it's detached. + (gtk_notebook_calculate_tabs_allocation): focus_tab may be different + to the detached tab if we hover the arrows during a tabs detaching + operation, do not allocate it unconditionally in 0,0. + 2006-12-26 Carlos Garnacho Expose improvements for GtkNotebook. Bug #383435 diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index bcd140b218..263c040d1c 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -2203,6 +2203,8 @@ gtk_notebook_do_arrow (GtkNotebook *notebook, dir = ARROW_IS_LEFT (arrow) ? GTK_DIR_UP : GTK_DIR_DOWN; else dir = ARROW_IS_LEFT (arrow) ? GTK_DIR_LEFT : GTK_DIR_RIGHT; + + gtk_widget_grab_focus (widget); gtk_widget_child_focus (widget, dir); } } @@ -2619,7 +2621,11 @@ gtk_notebook_stop_reorder (GtkNotebook *notebook) GtkNotebookPage *page; priv = GTK_NOTEBOOK_GET_PRIVATE (notebook); - page = notebook->cur_page; + + if (priv->operation == DRAG_OPERATION_DETACH) + page = priv->detached_tab; + else + page = notebook->cur_page; if (!page) return; @@ -3090,6 +3096,9 @@ gtk_notebook_drag_end (GtkWidget *widget, gtk_notebook_stop_reorder (GTK_NOTEBOOK (widget)); + if (priv->detached_tab) + gtk_notebook_switch_page (GTK_NOTEBOOK (widget), priv->detached_tab, -1); + GTK_BIN (priv->dnd_window)->child = NULL; gtk_widget_destroy (priv->dnd_window); priv->dnd_window = NULL; @@ -4437,8 +4446,7 @@ gtk_notebook_paint (GtkWidget *widget, if (!notebook->first_tab) notebook->first_tab = notebook->children; - if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, notebook->cur_page) || - !GTK_WIDGET_MAPPED (notebook->cur_page->tab_label)) + if (!GTK_WIDGET_MAPPED (notebook->cur_page->tab_label)) page = GTK_NOTEBOOK_PAGE (notebook->first_tab); else page = notebook->cur_page; @@ -5234,18 +5242,16 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook, page->allocation = child_allocation; - if (page == notebook->cur_page) + if ((page == priv->detached_tab && priv->operation == DRAG_OPERATION_DETACH) || + (page == notebook->cur_page && priv->operation == DRAG_OPERATION_REORDER)) { - if (priv->operation == DRAG_OPERATION_REORDER || - priv->operation == DRAG_OPERATION_DETACH) - { - /* needs to be allocated at 0,0 - * to be shown in the drag window */ - page->allocation.x = 0; - page->allocation.y = 0; - } + /* needs to be allocated at 0,0 + * to be shown in the drag window */ + page->allocation.x = 0; + page->allocation.y = 0; } - else + + if (page != notebook->cur_page) { switch (tab_pos) { -- 2.30.2